package com.heima.user.controller.v1;

import com.heima.model.common.dtos.app.LoginDto;
import com.heima.model.common.dtos.common.ResponseResult;
import com.heima.user.service.ApUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * APP端用户登录
 */
@Api(value = "/api/v1/login", tags = {"APP端用户登录"})
@Slf4j
@RestController
@RequestMapping("/api/v1/login")
public class ApUserLoginController {
    @Autowired
    private ApUserService apUserService;

    /**
     * APP端登录功能
     * @param loginDto
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "LoginDto", name = "loginDto", value = "", required = true)
    })
    @ApiOperation(value = "APP端登录功能", notes = "APP端登录功能", httpMethod = "POST")
    @PostMapping("/login_auth")
    public ResponseResult login(@RequestBody LoginDto loginDto) {
        return apUserService.login(loginDto);
    }
}
